package com.qingcheng.service.impl;

import com.qingcheng.dao.AdminMapper;
import com.qingcheng.pojo.system.Admin;
import com.qingcheng.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCrypt;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.io.Console;
import java.util.List;

@Service
public class LoginServiceImpl implements LoginService {

    @Autowired
    private AdminMapper adminMapper;

    @Override
    public Admin queryLogin(String loginName) {
        Admin admin=new Admin();
        admin=null;
        Example example=new Example(Admin.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("loginName",loginName);
        List<Admin> admins = this.adminMapper.selectByExample(example);
        if (admins.size()==0){
            return admin;
        }

        admin=admins.get(0);
        return admin;
    }
}
